# base url
NEW_BASE_URL = 'http://127.0.0.1:8000'
# 首页展示陆良
DEFAULT_LIMIT = 3
# 主从数据库
DATABASES = {
    # 主库
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'youzhu',
        'USER': 'youzhu',
        'PASSWORD': 'llzdnb',
        'HOST': '1.116.131.59',
        'PORT': 33307,
    },
    # 从库
    'db1': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'youzhu',
        'USER': 'root',
        'PASSWORD': '123456',
        'HOST': '1.116.131.59',
        'PORT': 33306,
    },
}

# 注册一下 # 4 以后只要是写操作，就会用default，只要是读操作自动去db1
DATABASE_ROUTERS = ['youzhu_api.db_router.Router1']

# 腾讯云短信配置
TENCENT_SMS_APPID = 1400501766  # 自己应用ID
TENCENT_SMS_APPKEY = "335d2a7dc7ddfc2aa3b27c594587c280"  # 自己应用Key
TENCENT_SMS_SIGN = "python后端接口开发"  # 签名管理里面的 自己腾讯云创建签名时填写的签名内容（使用公众号的话这个值一般是公众号全称或简称）

# 模板id，两种模型选择
TENCENT_SMS_TEMPLATES = {
    'register': 993292,
    'login': 993155
}

# redis
CACHES = {
    # 默认缓存
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://1.116.131.59:8888/0",  # 安装redis的主机的 IP 和 端口
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "CONNECTION_POOL_KWARGS": {
                "max_connections": 1000,
                "encoding": 'utf-8'
            },
            "PASSWORD": "foobared"  # redis密码
        }
    },
    # 提供存储短信验证码
    "sms_code": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://1.116.131.59:8888/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "CONNECTION_POOL_KWARGS": {
                "max_connections": 1000,
                "encoding": 'utf-8'
            },
            "PASSWORD": "foobared"  # redis密码
        }
    }
}
import datetime

JWT_AUTH = {
    # 过期时间1天
    'JWT_EXPIRATION_DELTA': datetime.timedelta(days=7),
}

